import { initConfig } from "@/utils/pageConfig";

const page = {
  state: {
    //直播状态
    liveStatus: false,
    liveCurrentlyOnlineCount: 0,
    liveTotalPopularityCount: 0,
    keyWordContent: "",
    userEnterContent: "",
    mainAudioFileList: [],
    config: _.merge({}, initConfig),
  },

  mutations: {
    updatePageConfig: (state, config = {}) => {
      _.merge(state.config, config);
    },
    setLiveCurrentlyOnlineCount: (state, count = 0) => {
      state.liveCurrentlyOnlineCount = count;
    },
    setLiveTotalPopularityCount: (state, count = 0) => {
      state.liveTotalPopularityCount = count;
    },
    setKeywordContent: (state, content) => {
      state.keyWordContent = content;
    },
    setUserEnterContent: (state, content) => {
      state.userEnterContent = content;
    },
    setMainAudioFileList: (state, list) => {
      state.mainAudioFileList = list;
    },
  },
  actions: {
    updatePageConfig({ commit }, config) {
      commit("updatePageConfig", config);
    },

    setLiveCurrentlyOnlineCount({ commit }, count) {
      commit("setLiveCurrentlyOnlineCount", count);
    },
    setLiveTotalPopularityCount({ commit }, count) {
      commit("setLiveTotalPopularityCount", count);
    },
    setKeywordContent({ commit }, content) {
      commit("setKeywordContent", content);
    },
    setUserEnterContent({ commit }, content) {
      commit("setUserEnterContent", content);
    },
    setMainAudioFileList({ commit }, list) {
      commit("setMainAudioFileList", list);
    },

  }
};

export default page;

